Skip to content

Add date and value filters to Backfills UI API#70151

Open
Phinhas214 wants to merge 3 commits into
apache:mainfrom
Phinhas214:backfills-ui-filters
Open

Add date and value filters to Backfills UI API#70151
Phinhas214 wants to merge 3 commits into
apache:mainfrom
Phinhas214:backfills-ui-filters

Conversation

@Phinhas214

@Phinhas214 Phinhas214 commented Jul 21, 2026

Copy link
Copy Markdown

Related: #53049

Add date and value filters to the Backfills tab UI.

Adds 6 of the 8 filters requested in #53049 to the Backfills tab: start_date, end_date,
created_at, completed_at, reprocess_behavior, and max_active_runs.
The remaining 2 filters duration and status are deliberately left out see "Open questions for reviewers" below.

Before

Screenshot 2026-07-20 at 4 37 14 PM

After

backfill_filters_recording.mov

Open questions for reviewers

duration

  • Motivation: Surfaces long-running backfills that may impact system performance
  • Backfill has no duration column. DagRun derives its duration from
    end_date - start_date via a dialect-aware hybrid_property, but Backfill has neither of
    those columns. The closest fields are created_at/completed_at. Mirroring DagRun's pattern directly on those fields means a running
    backfill has completed_at = NULL, so duration IS NULL, and NULL fails any SQL
    comparison. This implementation would silently exclude every
    currently running backfill, even though "surface long-running backfills" (the motivation for duration filter) should include ones still running in my opinon.
  • One option: compute duration as
    now() - created_at when completed_at IS NULL, so in-progress backfills still get a
    duration value. Would you like me to implement it that way, or handle it differently?

status

  • Motivation: Surface failed or incomplete backfills
  • similarly, Backfill has no status column — only is_paused and
    completed_at. list_backfills_ui already has a partial precedent (active, based on
    completed_at IS NULL) but this definition of status would only give us running vs. finished states.
  • Should status build on that directly, or does it need to look at
    associated DagRun states (e.g: join out to child DagRun states to support "failed" state?)

Happy to follow up on duration/status once there's a direction.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Sonnet 5) following the guidelines

@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Jul 21, 2026
@boring-cyborg

boring-cyborg Bot commented Jul 21, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

def list_backfills_ui(
limit: QueryLimit,
offset: QueryOffset,
start_date_range: Annotated[RangeFilter, Depends(datetime_range_filter_factory("from_date", Backfill))],

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • start_date/end_date are exposed as public filter names, but Backfill has no columns
    with those literal names. The underlying columns are from_date/to_date.
  • Used
    datetime_range_filter_factory's attribute_name argument to map the public-facing name to
    the real column, so the API surface matches what DagRun already exposes without renaming
    Backfill's columns.

end_date_range: Annotated[RangeFilter, Depends(datetime_range_filter_factory("to_date", Backfill))],
created_at: Annotated[RangeFilter, Depends(datetime_range_filter_factory("created_at", Backfill))],
completed_at: Annotated[RangeFilter, Depends(datetime_range_filter_factory("completed_at", Backfill))],
max_active_runs: Annotated[RangeFilter, Depends(float_range_filter_factory("max_active_runs", Backfill))],

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max_active_runs is implemented as a RangeFilter (via float_range_filter_factory) rather
than an exact-match FilterParam, since the issue frames it as diagnosing throttling
("more/fewer than N active runs"), which a range serves better than exact equality.

@Phinhas214
Phinhas214 force-pushed the backfills-ui-filters branch from 1c7d9e9 to c4fdc46 Compare July 24, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant